package com.xmall.mapper;

import com.xmall.bean.table.Comment;
import com.xmall.bean.table.CommentExample;
import com.xmall.bean.vo.goodsdetail.GoodsDetailCommentInfoVo;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

public interface CommentMapper {
    long countByExample(CommentExample example);

    int deleteByExample(CommentExample example);

    int deleteByPrimaryKey(Integer id);

    int insert(Comment record);

    int insertSelective(Comment record);

    List<Comment> selectByExample(CommentExample example);

    Comment selectByPrimaryKey(Integer id);

    int updateByExampleSelective(@Param("record") Comment record, @Param("example") CommentExample example);

    int updateByExample(@Param("record") Comment record, @Param("example") CommentExample example);

    int updateByPrimaryKeySelective(Comment record);

    int updateByPrimaryKey(Comment record);

    /**
     * 统计商品的总评论数和总图片数
     * @param valueId
     * @param type
     * @return
     */
    Map<String, Long> countComment(@Param("valueId") Integer valueId, @Param("type") Byte type);

    List<GoodsDetailCommentInfoVo> selectByGoodsId(@Param("id") Integer id);

}